package com.gzy.network.observer;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

/**
 * @author : guzy
 * @program: net-app
 * @description: 自定义Observer
 * @date : 2022-03-24 12:06
 **/
public abstract class BaseObserver<T> implements Observer<T> {

  //开始
  @Override
  public void onSubscribe(Disposable d) {

  }

  //继续
  @Override
  public void onNext(T t) {
    onSuccess(t);
  }

  //异常
  @Override
  public void onError(Throwable e) {
    onFailure(e);
  }

  //完成
  @Override
  public void onComplete() {

  }

  //成功
  public abstract void onSuccess(T t);
  //失败
  public abstract void onFailure(Throwable e);
}